import { _decorator, Component, Node, Label } from 'cc';
import { GameConfig } from './config/GameConfig';
const { ccclass, property } = _decorator;

@ccclass('LifeMgr')
export class LifeMgr extends Component {
    
    
    life: number;

    // 设置生命数量
    setLifeAmount(amount: number) {
        this.life = amount
        GameConfig.heroLife = this.life
        this.getComponent(Label).string = this.life + ''
    }


    // 减少
    reduceLifeAmount(amount: number = 1) {
        this.life -= amount
        GameConfig.heroLife = this.life
        this.getComponent(Label).string = this.life + ''
    }


}


